import Vue from 'vue';
import Vuex from 'vuex';
// import cloneDeep from 'lodash/cloneDeep';
import common from './modules/common';
import user from './modules/user';
import gis from './modules/gis';
import permission from './modules/permission';
import persistedState from 'vuex-persistedstate'; // vuex数据持久化，解决刷新浏览器数据清空问题
Vue.use(Vuex);

export default new Vuex.Store({
  modules: {
    common,
    user,
    permission,
    gis
  },
  mutations: {
    // 重置vuex本地储存状态
    // resetStore(state) {
    //   Object.keys(state).forEach((key) => {
    //     state[key] = cloneDeep(window.SITE_CONFIG['storeState'][key]);
    //   });
    // }
  },
  strict: process.env.NODE_ENV !== 'production',
  plugins: [persistedState()]
});
